<script setup lang="ts">
import {nextTick, onMounted, ref} from 'vue'
import {ElMessage} from 'element-plus'

import keymaster from 'keymaster'


const isRouterAlive = ref(true)

function reset() {
  isRouterAlive.value = false
  nextTick(function () {
    isRouterAlive.value = true
  })
}

onMounted(() => {
  keymaster('f5', function () {
    reset()
    ElMessage('refresh')
    return false
  })
})
</script>

<template>
  <router-view v-if="isRouterAlive"/>
  <!--<div class="resetButton">-->
  <!--  <el-button @click='reset' type='success' icon='Refresh' circle plain></el-button>-->
  <!--</div>-->
</template>

<style lang="scss">
//.resetButton {
//  position: fixed;
//  //bottom: 25px;
//  //left: 5px;
//  top: 15px;
//  right: 35px;
//  z-index: 100;
//}

body {
  //padding 5px
  -webkit-user-select: none;
  -webkit-app-region: drag;
}

html, body {
  height: 100%;
}
::-webkit-scrollbar {
  display: none;
}

button,
input,
svg,
a,
.noDrag,
.el-switch,
.el-checkbox-button,
.el-radio-group,
.el-table__column-filter-trigger {
  -webkit-app-region: no-drag;
}
</style>
